package com.csx.base.design.behavior.strategy.example.exampleA;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cuisongxu
 * @date 2022/9/29 12:27
 */
@RestController
@RequestMapping("pay")
public class PayController {

    @Autowired
    private PayStrategyContext payStrategyContext;

    @PostMapping
    public boolean pay(@RequestBody PayDTO payDTO) {

        // 此处最好在Service层做
        return payStrategyContext.payHandle(payDTO);
    }
}
